package org.bemuv;

import org.bemuv.R;

import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.AutoCompleteTextView;
import android.widget.ImageButton;
import android.widget.Toast;

public class SearchFragment extends Fragment {
	private ImageButton btn_search;
	private AutoCompleteTextView txt_search;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,		Bundle savedInstanceState) {
		View view = inflater
				.inflate(R.layout.fragment_search, container, false);
		btn_search = (ImageButton) view.findViewById(R.id.btn_search);
		txt_search = (AutoCompleteTextView) view.findViewById(R.id.txt_search);
		btn_search.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				launch_result();
			}
		});
		return view;
	}
	
	public void launch_result(){
		Intent i = new Intent(getActivity(), QueryActivity.class);
		i.putExtra("txt_search", txt_search.getText().toString());
        startActivity(i);
        getActivity().finish();
	}
	
}
